#import "SEGSubmitpropertyownerauthManager.h"

#if __has_include(<Commom/SEGModel.h>)
#import <Commom/SEGModel.h>
#else
#import "SEGModel.h"
#endif
#if __has_include(<Commom/SEGHTTPBusinessManager.h>)
#import <Commom/SEGHTTPBusinessManager.h>
#else
#import "SEGHTTPBusinessManager.h"
#endif

static id _submitPropertyOwnerAuthManager;
static dispatch_once_t onceToken;

@implementation SEGSubmitpropertyownerauthManager
#pragma mark - SINGLE----BEGIN----
+(instancetype)sharedManager{
    dispatch_once(&onceToken, ^{
        _submitPropertyOwnerAuthManager = [[self alloc] init];
    });
    return _submitPropertyOwnerAuthManager;
}

+(void)destroyResource{
    onceToken = 0;
    _submitPropertyOwnerAuthManager = nil;
}

#pragma mark - SINGLE----END----

#pragma mark - HTTP----BEGIN----

/// APP端-业主认证（）
/// @see http://192.168.1.11:9090/html/web/controller/share/share.html#5ece12d6726846c8c24d4bda
/// @param custId 客户ID
/// @param tel 手机号
/// @param custName 客户名称
/// @param communityId 项目ID
/// @param houseId 房屋ID
/// @param cardNbr 身份证号
/// @param custGender 客户性别（查询客户列表有返回）
/// @param businessCode 短信业务编码
/// @param smsCode 短信验证码
-(void)requestSubmitpropertyownerauthWithCustid:(NSString*)custId tel:(NSString*)tel custName:(NSString*)custName communityId:(NSString*)communityId houseId:(NSString*)houseId cardNbr:(NSString*)cardNbr custGender:(NSString*)custGender businessCode:(NSString*)businessCode smsCode:(NSString*)smsCode finished:(void(^)(BOOL isSuccessed,id result,NSString* codeType,NSString* errorMessage))finished{
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setValue:custId forKey:@"custId"];
    [params setValue:tel forKey:@"tel"];
    [params setValue:custName forKey:@"custName"];
    [params setValue:communityId forKey:@"communityId"];
    [params setValue:houseId forKey:@"houseId"];
    [params setValue:cardNbr forKey:@"custCard"];
    [params setValue:custGender forKey:@"custGender"];
    [params setValue:businessCode forKey:@"businessCode"];
    [params setValue:smsCode forKey:@"smsCode"];
    
    NSString *urlString = [SEGServerManager serverUrlJoint:kClientRootURL,@"/uhomecp-sso/v2/userHouse/submitPropertyOwnerAuth",nil];
    [SEGHTTPBusinessManager seg_requestJSONWithMethod:POST URLString:urlString parameters:params completed:^(BOOL isSuccessed, id result, NSString *codeType, NSError *error) {
        if (!isSuccessed) {
            finished(isSuccessed,nil,codeType,error.localizedDescription);
            return;
        }
        
        self.submitPropertyOwnerAuth = [SEGSubmitpropertyownerauthModel yy_modelWithDictionary:result];
        finished(isSuccessed,result,codeType,error.localizedDescription);
        return;
    }];
}
#pragma mark - HTTP----END----

#pragma mark - GETTER----BEGIN----
-(SEGSubmitpropertyownerauthModel *)submitPropertyOwnerAuth{
    if (!_submitPropertyOwnerAuth) {
        _submitPropertyOwnerAuth = [[SEGSubmitpropertyownerauthModel alloc]init];
    }
    return _submitPropertyOwnerAuth;
}
#pragma mark - GETTER----END----
@end
